package com.google.shop.product.common.utils;

//import org.apache.commons.configuration.tree.DefaultExpressionEngine;

/* loaded from: app.jar:BOOT-INF/lib/shop-common-0.0.1-SNAPSHOT.jar:com/google/shop/common/utils/R.class */
public class R<T> {
    private Integer code;
    private String msg;
    private T data;

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof R)) {
            return false;
        }
        R<?> other = (R) o;
        if (!other.canEqual(this)) {
            return false;
        }
        Object this$code = getCode();
        Object other$code = other.getCode();
        if (this$code == null) {
            if (other$code != null) {
                return false;
            }
        } else if (!this$code.equals(other$code)) {
            return false;
        }
        Object this$msg = getMsg();
        Object other$msg = other.getMsg();
        if (this$msg == null) {
            if (other$msg != null) {
                return false;
            }
        } else if (!this$msg.equals(other$msg)) {
            return false;
        }
        Object this$data = getData();
        Object other$data = other.getData();
        return this$data == null ? other$data == null : this$data.equals(other$data);
    }

    protected boolean canEqual(Object other) {
        return other instanceof R;
    }

    public int hashCode() {
        Object $code = getCode();
        int result = (1 * 59) + ($code == null ? 43 : $code.hashCode());
        Object $msg = getMsg();
        int result2 = (result * 59) + ($msg == null ? 43 : $msg.hashCode());
        Object $data = getData();
        return (result2 * 59) + ($data == null ? 43 : $data.hashCode());
    }

//    public String toString() {
//        return "R(code=" + getCode() + ", msg=" + getMsg() + ", data=" + getData() + DefaultExpressionEngine.DEFAULT_INDEX_END;
//    }

    public Integer getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }

    public T getData() {
        return this.data;
    }

    public static R ok(Object data) {
        R r = new R();
        r.setCode(0);
        r.setMsg("成功");
        r.setData(data);
        return r;
    }

    public static R error(String error) {
        R r = new R();
        r.setCode(1);
        r.setMsg(error);
        r.setData(null);
        return r;
    }

    public static R ok() {
        R r = new R();
        r.setCode(0);
        r.setMsg("成功");
        return r;
    }
}
